<?php
/**
 * @package Sj Mega News
 * @version 2.5
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
 * @copyright (c) 2012 YouTech Company. All Rights Reserved.
 * @author YouTech Company http://www.smartaddons.com
 * 
 */
defined('_JEXEC') or die;

	ob_start();
	include JModuleHelper::getLayoutPath($module->module,'styles');
	$stylesheet=ob_get_contents();
	ob_end_clean();
	$docs=JFactory::getDocument();
	$docs->addStyleDeclaration($stylesheet); 
?>
<?php if(!empty($list)){?>
    <div id="yt-mega-news_<?php echo $module->id;?>" class="yt_mega_news" style="width:<?php echo $params->get('width_module');?>px;">	
     <div class="intro_text" style="width:<?php echo $params->get('width_module');?>px"><?php echo $params->get('intro_text'); ?></div>
        <div id="ytc_tabs<?php echo $module->id;?>" class="theme1">                          
						   <?php    	      					
						   if(!empty($list)){	$ij=1;	$counttotal = count($list);  
						   foreach ($list as $key=>$value) {   
						          $firstval = current($value);  
		 if ($ij==1) {
		 ?>
		  <div style="width: <?php echo $params->get('width_module');?>px;  float:left; margin-bottom: 20px"> <?php }?>
		   <div class="box_mega" style="width: <?php echo (($params->get('width_module')/ $params->get('numcols'))-20);?>px; "> 			
			 	<div class="tabs" >			   
				<div class="category_title_left">&nbsp;</div>
				<div class="category_title_center">
				<div class="category_name">
				<a href="<?php echo $firstval['category_link'];?>" target="<?php echo  $params->get('target');?>">
				<?php echo $firstval['category_sub_title']; ?>
				</a>
				</div>
				</div> 
				<div class="category_title_right">&nbsp;&nbsp;&nbsp; </div>
			    </div> <!--end tabs-->
                <div class="box-wrapper" style="width: <?php echo (($params->get('width_module')/ $params->get('numcols'))-20);?>px; ">
                <?php 
                      $j=1;                    
                  //  $firstVal = current($item); 
                ?>
                    <div class="content-box <?php if($j==1) echo "current";?>" style="max-width:<?php echo (($params->get('width_module')/ $params->get('numcols'))-20);?>px; width: <?php echo (($params->get('width_module')/ $params->get('numcols'))-20);?>px; ">
					<div class="normal-content" style="width: <?php echo (($params->get('width_module')/ $params->get('numcols'))-20);?>px; ">	
					    <?php if($params->get('show_title_article') ==1){?>
                        <div class="article_title">      						
                        <?php if($params->get('link_title_article') == 1) {?>
						<a style="color:<?php echo $params->get('title_article_color');?>;" href="<?php echo $firstval['article_link'];?>" target="<?php echo $params->get('target');?>">                
                        <?php echo $firstval['article_sub_title'];?>                
                        </a>                     
                        <?php }
                        else 
                        {
                        echo $firstval['article_sub_title'];  
                        }                         
                        ?>
						</div> 
                        <?php } ?>                             
					   
						<div class="col-two col" style="width: <?php echo (($params->get('width_module')/ $params->get('numcols'))-20);?>px; ">
						    <?php if (($params->get('show_image') == 1) && ($firstval['article_image']!='')){ ?>
                            <div class="image" style="width: <?php echo $params->get('item_thumbnail_width');?>px; height: <?php echo $params->get('item_thumbnail_height');?>px"> 
							<?php                                     
							
							 if($params->get('link_image') ==1) {?>
							
							<a href="<?php echo $firstval['article_link'];?>" target="<?php echo $params->get('target');?>">
							<img src="<?php echo $firstval['article_image']?>" alt="<?php echo $firstval['article_sub_title'];?>" width=" <?php echo $params->get('item_thumbnail_width');?>px;" height=" <?php echo $params->get('item_thumbnail_height');?>px;" />
							
							</a>
							
							<?php  } 
							else 
							{?>
							<img src="<?php echo $firstval['article_image']?>" alt="<?php echo $firstval['article_sub_title'];?>" width=" <?php echo $params->get('item_thumbnail_width');?>px;" height=" <?php echo $params->get('item_thumbnail_height');?>px;" />
							<?php } ?>
							</div>
							<?php } ?>
							<div>					
							<?php if ($params->get('show_description') == 1){  ?>
                             <div class="sub_content">
                                <?php   echo $firstval['article_content']; ?>                                    
                             </div>
                             <?php }?>    
                           <?php //  var_dump($params->get('read_more_text'));die();?> 
                            <?php if ($params->get('show_read_more_link') == 1) {?>   
                           <div class="read_more">

						   <a href="<?php echo $firstval['article_link'];?>" target="<?php echo $params->get('target');?>"><?php echo $params->get('read_more_text');?>
						   </a></div>
                            <?php }?>
                          </div>
						 </div>                     
						 <div class="col-three" style="width: <?php echo (($params->get('width_module')/ $params->get('numcols'))-20);?>px; ">
							<?php $i=1; foreach($value as $key1=>$value1){ if($i==2){?>
                            <div style="color:#7a7a7b; font-weight: bold; padding-top: 5px; padding-bottom: 5px"> Các bài viết khác: </div>
							<?php };$i++;}?> 
                            <ul class="link"> 
							<?php $i=1; foreach($value as $key1=>$value1){ if($i!=1){?>
                                <li>
								<div class="arrow">&nbsp;&nbsp;</div>
								<a style="color:<?php echo  $params->get('title_article_color');?>;" href="<?php echo $value1['article_link']?>" target="<?php echo $params->get('target'); ?>"><?php echo $value1['article_sub_title']?></a></li>
                                 <?php };$i++;}?>                              
                            </ul>
					 	 
						    <?php if ($params->get('show_all_articles') ==1) { ?>
                            
                            <div class="link_category"> 
								<div class="arrow1"> &nbsp;</div>       						
								<a href="<?php echo $firstval['category_link'];?>" target="<?php echo $params->get('target');?>">
								<?php echo $params->get('view_all_text');?>
								</a>
								              
                            </div>
                            <?php }?>		
						</div>	
					</div> <!--end normal-content-->  		
					
			</div> <!--end content-box-->  							
            </div> <!-- END Box Wrapper -->			  
				 </div> <!--end box-->  	
				 <?php if(($counttotal) == $ij){?>
                        </div><?php } else {?>
                        <?php if($ij%$params->get('numcols') ==0  ) {?> </div><div style="width: <?php echo $params->get('width_module');?>px;  float:left; margin-bottom: 20px"> <?php }?>
                        <?php }?>                             
                        <?php $j++; $ij++;}} ?>                                    
				
         </div><!--end theme1-->
       <div class="footer_text" style="width:<?php echo $params->get('width_module');?>px"><?php echo $params->get('footer_text'); ?></div>
    </div>   
  <?php } else { echo JText::_('Has no content to show!');}?>